package edu.egypt.timepickerdialogsample;

import android.app.Activity;
import android.app.TimePickerDialog;
import android.app.TimePickerDialog.OnTimeSetListener;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TimePicker;
import android.widget.Toast;

public class TimePickerDialogSampleActivity extends Activity implements OnClickListener {
    private Button button;
	private OnTimeSetListener timeListener = new OnTimeSetListener() {
		
		@Override
		public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
			String selectedTime = "Time:"+hourOfDay+":"+minute;
			Toast.makeText(TimePickerDialogSampleActivity.this, selectedTime, Toast.LENGTH_SHORT).show();
		}
	};

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        button = (Button)findViewById(R.id.button1);
        button.setOnClickListener(this);
    }

	@Override
	public void onClick(View v) {
		TimePickerDialog tpDialog = new TimePickerDialog(this, timeListener, 12, 00, false);
		tpDialog.show();
		
	}
	
	
}